package jmind.asteroidea.core.reducer;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * description:
 *
 * @author weibo.xie
 * @date:2022/7/11 上午11:26
 */
public abstract class Reducer<R> {

    private Map<String, R> resultMap = new LinkedHashMap<>();

    /**
     * 是否中断，不往下走
     * @param tag
     * @param result
     * @return
     */
    public abstract boolean isBreak(String tag,R result);

    /**
     * 处理结果
     * @return
     */
    public abstract R reduce();

    public R addResult(String tag,R result){
      return   resultMap.put(tag,result);
    }

    public Map<String, R> getResult(){
        return resultMap;
    }


}
